<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="https://s3.pstatp.com/cdn/expire-1-M/jquery/3.1.1/jquery.min.js"></script>
	</head>
	<body>
		<input type="datetime-local" value="" id="ddd"/>
		<button onclick="getOneObj2()">POST请求(新增)</button>
		<script>
		function getOneObj2() {
			let birth = document.getElementById("ddd").value;
			console.log('date:', birth)
		    let user = {uname: "zhangsan", birth: birth}; // JSON对象
		    $.ajax({
		        url: "http://localhost:8080/ddd",
		        type: "post", // 请求方式
		        dataType: "JSON",// 后端返回给前端的格式
		        data: JSON.stringify(user),
		        contentType: "application/json;charset=UTF-8", // 前端给后端传递JSON字符串的时候要用
		        success:function(res) {
		                console.log("res", res)
		        },
		        complete:function(res) {
		                console.log("res", res)
		        }
		    });
		}
		</script>
	</body>
</html>